import sys

def xor_file_with_0x12(file_path):
    try:
        with open(file_path, 'rb') as file:
            data = file.read()

        # 每个字节和 0x12 进行异或
        modified_data = bytes([byte ^ 0x12 for byte in data])

        with open(file_path, 'wb') as file:
            file.write(modified_data)

        print(f"已处理文件: {file_path}")
    except Exception as e:
        print(f"处理文件时出错: {e}")

if __name__ == "__main__":
    if len(sys.argv) != 2:
        print("用法: python xor_file.py <文件路径>")
    else:
        xor_file_with_0x12(sys.argv[1])
